﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Agnes.Core;
using Caliburn.Micro;

namespace Agnes.TaskManager
{
    /// <summary>
    /// TaskPadView.xaml 的交互逻辑
    /// </summary>
    public partial class TaskPadView : UserControl
    {
        public TaskPadView()
        {
            InitializeComponent();
        }

        private void TextBlock_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                if (e.ClickCount == 2)
                {
                    TextBlock tb = sender as TextBlock;
                    Task task = tb.DataContext as Task;
                    TaskEditorViewModel vm = new TaskEditorViewModel(task, true);
                    IWindowManager windowManager = IoC.Get<IWindowManager>();
                    windowManager.ShowDialog(vm);
                }
            }
            catch (Exception ex)
            {
                AgnesServiceManager.LogServ.Error("TaskManager--打开任务失败：" + ex.Message);
            }
        }
    }
}
